package com.nowcoder.community.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nowcoder.community.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Select("SELECT * FROM `user` WHERE username = #{name}")
    User selectByName(String name);

    @Update("UPDATE `user` SET password = #{password} WHERE id = #{userId}")
    void updatePassword(int userId, String password);

    @Update("UPDATE `user` SET header_url = #{headerUrl} WHERE id = #{userId}")
    void updateHeaderUrl(int userId, String headerUrl);
}
